package com.qm.console.controller.rest;

import com.qm.console.controller.dto.BaseRsp;
import com.qm.console.pubdef.dto.appversion.AppVersionUpdateAdminDTO;
import com.qm.console.pubdef.dto.channel.ChannelUpdateAdminDTO;
import com.qm.console.service.appversion.AppVersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/appVersion")
public class AppVersionController {
    @Autowired
    private AppVersionService AppVersionService;

    @GetMapping("/list")
    public BaseRsp listAppVersionAdmin(@RequestParam(value = "limit", required = false, defaultValue = "20") String limit,
                                    @RequestParam(value = "page", required = false, defaultValue = "1") String page){
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("pageSize", limit);
        paramMap.put("pageNum", page);
        return AppVersionService.listAppVersionAdmin(paramMap);
    }

    @PostMapping("/update")
    public BaseRsp updateAppVersionAdmin(@RequestBody AppVersionUpdateAdminDTO updateDTO){
        return AppVersionService.updateAppVersionAdmin(updateDTO);
    }

    @DeleteMapping("/delete")
    public BaseRsp DeleteAppVersionAdmin(@RequestBody String params){
        return AppVersionService.DeleteAppVersionAdmin(params);
    }


}
